<template>
      <div v-if="zt" id="lulantu3" style="width: 1200px; height: 800px">
        <component :is="zt"></component>
      </div>
 </template>
<script>
import { defineComponent,   } from 'vue'
import html2canvas from 'html2canvas'
import regCom from './registerComFunV2' 

export default defineComponent({
  props: {
   
  }, 
  setup(props, ctx) {
    const { isShowEdit, addEditFun, list } = toRefs(props)

    //====aliyun 拿到上传图片前的签名========
    const fileList = ref(null)
    function dataURLtoFile(dataurl, filename) {
      var mime = 'image/jpg',
        bstr = atob(dataurl),
        n = bstr.length,
        u8arr = new Uint8Array(n)
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n)
      }
      return new File([u8arr], filename, { type: mime })
    }


    /****== 主体程序 =================================****/

    ctx.emit('closeEdit', false)


    //===转代码转网页元素================
    const zt = ref(null)
    const click_zhuanyuansu = () => {
      zt.value = regCom(modelRef.html)
      setTimeout(() => {
        suofang()
      }, 10)
    }

    //==缩放===========
    const smaillmap = ref(null)
    function suofang() {
      let block = document.getElementById('lulantu3')
      html2canvas(block, {
        useCORS: true,
      }).then((res) => {
        smaillmap.value = res.toDataURL('image/jpeg')
        zt.value = null
      })
    }

    return {
      visible,
      handleOk,
      title,
      cancal,
      validateInfos,
      modelRef,
      zt,
      htmlChange,
      saveToAliyun,
      smaillmap,
      onAfterVisibleChange,
      modalClose,
    }
  },
})
</script>
 
